﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Diagnostics;

namespace pos_trab_2.View
{
    public partial class MailInputBox : Form
    {
        public MailInputBox(ControleSenha owner)
        {
            InitializeComponent();
            this.Owner = owner;
        }

        private void btnEnviar_Click(object sender, EventArgs e)
        {
            Type t = this.Owner.GetType();
            
            if (t == typeof(ControleSenha))
            {
                t.GetProperty("EmailDestino").SetValue(this.Owner, this.txtEmailDestino.Text, null);
                t.GetProperty("SmtpServer").SetValue(this.Owner, this.txtSmtpServer.Text, null);
                t.GetProperty("Chave").SetValue(this.Owner, this.txtPalavraChave.Text, null);
                t.GetMethod("enviaEmail").Invoke(this.Owner, null);
            }
            this.Dispose();
        }
    }
}
